<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp" %>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>登录页面</title>
    <link   rel="stylesheet" href="${ctx}/ui/pre/css/style.css"  type="text/css">
    <script src="${ctx}/ui/jslib/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="${ctx}/ui/jslib/extJquery.js?v=201305301341" charset="utf-8"></script>
    <script type="text/javascript">
        document.onkeydown=function() {
            if(event.keyCode==13) {
                formSubmit();
            }
        }

        function formSubmit(){
            var ajaxCallUrl = '${ctx}/user/logins';
            var name = $("#name").val();
            var pass = $("#pass").val();
            if(name!=''){
                $.ajax({
                    type: "POST",
                    url:ajaxCallUrl,
                    data:$.serializeObject($('#logins')),
                    async: false,
                    error: function(request) {
                        alert("用户名或密码错误!");
                    },
                    success: function(data) {
                        if(data.success){
                            self.location = '${ctx}/user/toIndex.shtml';
                        }else{
                            alert(data.msg);
                            $("#name").val('');
                            $("#pass").val('');
                        }
                    }
                });
            }else{
                $("#name").val('');
                $("#pass").val('');
            }
        }
        function clearInfo(){
            $("#name").val('');
            $("#pass").val('');
        }
    </script>
</head>

<body class="login">
<script>
    var h=$(document).height();
    $("body").css("height",h);
</script>
<img src="${ctx}/ui/pre/images/fly.png" class="fly">
<div class="box">
    <img src="${ctx}/ui/pre/images/car.png" class="car">
    <form id="logins">
        <div class="login">
            <div class="head">
                <img src="${ctx}/ui/pre/images/logo.png" class="logo floatL">
                <h1 class="floatL">公路路政执法智能管理系统</h1>
            </div>
            <div class="main">
                <span>账　号：</span><input type="text" name="username" id="name" autocomplete="off"><br>
                <span>密　码：</span><input type="password" name="password" id="pass" autocomplete="off"><br>
                <%--<span>验证码：</span><input class="input"><img src="images/yzm.jpg" class="yzm"><br>--%>
                <a onclick="formSubmit()" style="cursor:pointer;">登 录</a>
            </div>
        </div>
    </form>
</div>
</body>
</html>